package com.fancy.learncenter.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.fancy.learncenter.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.adapter.base.CustomViewHold;
import com.superservice.lya.R;

import java.util.ArrayList;

/**
 * Created by hyy on 2018/2/25.
 * Explain activity as
 */

public class MultiTextAdapter extends CommonRecycleViewAdapter<String> {
    public MultiTextAdapter(Context mContext, ArrayList<String> itemDatas) {
        super(mContext, R.layout.pupopwinodw_multi_text_item, itemDatas);
    }

    @Override
    public void bindView(CustomViewHold customViewHold, final String item, int position) {

        TextView content = customViewHold.getView(R.id.content);
        content.setText(item);

        customViewHold.getRoorView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (clickCallBack != null) {
                    clickCallBack.clickCallBack(item);
                }
            }
        });
    }

    private ClickCallBack clickCallBack;

    public void setClickCallBack(ClickCallBack clickCallBack) {
        this.clickCallBack = clickCallBack;
    }

    public interface ClickCallBack {
        abstract void clickCallBack(String content);
    }
}
